﻿<?php
	error_reporting(E_ALL & ~E_STRICT);
	include 'Mail.php';
	include 'Mail/mime.php' ;
	
	$from = "bugreport@domain.com";
	$to = "bugreceiver@domain.com";
        
	$crlf = "\n";
	$hdrs = array(
	'From'    => $from,
	'Subject' => $_POST['subject']
	);

	$mime = new Mail_mime(array('eol' => $crlf));

	if (isset($_POST['messageTxt']))
	{
		$mime->setTXTBody($_POST['messageTxt']);
	}
	if (isset($_POST['messageHtml']))
	{
		$mime->setHTMLBody($_POST['messageHtml']);
	}
	if (isset($_POST['attachment']))
	{
		$mime->addAttachment($_POST['attachment'], 'application/octet-stream', $_POST['attachmentName'], false);
	}

	$body = $mime->get();
	$hdrs = $mime->headers($hdrs);
        
	$mail =& Mail::factory('mail');
	echo $mail->send($to, $hdrs, $body);
?>